from pyecharts.charts import Bar
from pyecharts.options import TitleOpts, LabelOpts
import os

# 基础数据
value = [40, 30, 26, 22, 15]
attr = ["贵阳市", "遵义市", "六盘水市", "安顺市", "黔东南州"]

# 制作图表
bar = Bar()
bar.add_xaxis(attr)
bar.add_yaxis('GDP', value, label_opts=LabelOpts(position='right'))
bar.reversal_axis()

bar.set_global_opts(
    title_opts=TitleOpts(title="贵州GDP柱状图")
)

bar.render('简单柱状图.html')

# 打开网页
os.system("简单柱状图.html")
